package model;

/**
 * Paramètres globaux de l'application
 * @author Aubry Pirian
 *
 */
public final class Params {
	
	public static final String DB_TYPE="mysql";		// le type de la base de données utilisée

	public static final String DB_SERVER = "127.0.0.1";	// Adresse du serveur de base de données
	public static final String DB_USER = "root";		// nom d'utilisateur pour le serveur
	public static final String DB_PASSWD = "mysql";		// mot de passe de l'utilisateur
	public static final String DB_NAME = "room_game";	// nom de la base de données

//	public static final String _TABLE = "";
	public static final String MEMBER_TABLE = "member";
	public static final String ROOM_TABLE = "room";
	public static final String CONNECTION_TABLE = "connection";
	public static final String MATCH_TABLE = "match";
	public static final String GAME_TABLE = "game";
	
	// Numéros des tables
	public static final int MEMBER_ID = 0;
	public static final int ROOM_ID = 1;
	public static final int GAME_ID = 2;
	public static final int MATCH_ID = 3;
	public static final int CONNECTION_ID = 4;
	
	// Définition des attributs :
	public static final String[][][] TABLE_ATTRIBUTES = {
		{	// Member
			{"id","int","7","","true","true","p"},
			{"login","varchar","20","","true","false","u"},
			{"email","varchar","50","","true","false","u"},
			{"passwd","varchar","20","","true","false"},
			{"firstname","varchar","100","","true","false"},
			{"lastname","varchar","100","","true","false"},
			{"gender","enum","'-','m','f'","-","false","false"},
			{"rank","enum","'user','admin'","user","true","false"},
			{"status","enum","'new','accepted','blocked','banned'","new","true","false"},
			{"conf_code","varchar","25","","false","false"},
			{"date_reg","varchar","20","","true","false"},
		},
		{	// Room
			{"id","int","5","","true","true","p"},
			{"name","varchar","50","","true","false","u"},
			{"address","text","","","true","false"},
			{"status","enum","'open','hidden','closed'","hidden","true","false"},
		},
		{	// Game
			{"id","int","3","","true","true","p"},
			{"name","varchar","50","","true","false","u"},
			{"status","enum","'visible','hidden'","hidden","true","false"},
		},
		{	// Match
			{"id","int","7","","true","true","p"},
			{"game","int","3","","true","false"},
			{"start","varchar","20","","true","false"},
			{"end","varchar","20","","false","false"},
			{"creator","int","7","","true","false"},
			{"misc","longtext","","","false","false"},
		},
		{	// Connection
			{"member","int","7","","true","false"},
			{"room","int","5","","true","false"},
			{"date_in","varchar","20","","true","false"},
			{"date_out","varchar","20","","false","false"},
		}
	};
	
	public static final char BLANK_GENDER = TABLE_ATTRIBUTES[0][6][3].charAt(0);
	
	public static final int[] SIZES_LOGIN		= {5,20};
	public static final int[] SIZES_EMAIL		= {5,25};
	public static final int[] SIZES_FIRSTNAME	= {1,50};
	public static final int[] SIZES_LASTNAME	= {1,50};

}
